package com.ler.yrmall.ware.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ler.yrmall.ware.entity.WareSkuEntity;
import com.ler.yrmall.ware.form.WareSkuForm;
import com.ler.yrmall.ware.vo.WareSkuVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 * @author Leron
 */
@Mapper
public interface WareSkuMapper extends BaseMapper<WareSkuEntity> {

    Long getSkuStock(@Param("skuId") Long skuId);

    Integer skuLock(@Param("skuId") Long skuId, @Param("num") Integer num, @Param("aLong") Long aLong);

    void unStockLock(@Param("skuId") Long skuId, @Param("taskDetailId") Long taskDetailId, @Param("wareId") Long wareId, @Param("num") Integer num);

    List<Long> listWareIdHasSkuStock(@Param("skuId") Long skuId);

    IPage<WareSkuVO> find(@Param("page") Page<Object> page, @Param("request") WareSkuForm request);

    void increment(@Param("id") Long id, @Param("num") Integer num);
}
